<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <script src="jquery.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <meta charset="UTF-8">
    <title class="text-center">个人信息页面</title>
</head>
<body>


<table class="table table-striped">
    <thead>
    <tr>
        <th>学号</th>
        <th>姓名</th>
        <th>年级</th>
        <th>学院</th>
        <th>专业</th>
    </tr>
    </thead>
    <tbody>
        <tr>
            <td th:text="${msg.getSno()}"></td>
            <td th:text="${msg.getSname()}"></td>
            <td th:text="${msg.getSgrade()}"></td>
            <td th:text="${msg.getSdept()}"></td>
            <td th:text="${msg.getSmajor()}"></td>
        </tr>
    </tbody>
</table>


<form class="form-signin" th:action="@{/goToSelectCourse}">
    <div style="text-align:center">
        <button type="submit" class="btn btn-primary "  onclick="optionalCourse()">选课</button>
    </div>
</form>

<script src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script type=" text/javascript">
    function optionalCourse(){
        var Sno = JSON.stringify(window.localStorage.getItem("Sno"))
        console.log(window.localStorage.getItem("Sno"))
        $.ajax(
            {
                type:'post',
                url:'/courseShow',
                data:{
                    Sno:JSON.stringify(Sno)
                },
                success: function(){
                    //window.location.href="/courseShow"
                },
                error: function (returnValue) {
                    alert("对不起！数据加载失败！");
                },
                // contentType: "application/json;charset=utf-8",
                // traditional:true
            }
        );
    }
</script>

</body>
</html>

